// +build !no_service_probe

package exploit

import (
	"github.com/cdk-team/CDK/pkg/cli"
	"github.com/cdk-team/CDK/pkg/plugin"
	"github.com/cdk-team/CDK/pkg/tool/probe"
	"log"
)

// plugin interface
type serviceProbeS struct{}

func (p serviceProbeS) Desc() string {
	return "scan subnet to find Docker/K8s inner services, usage: cdk run service-probe 192.168.1.0-255"
}
func (p serviceProbeS) Run() bool {
	args := cli.Args["<args>"].([]string)
	if len(args) != 1 {
		log.Println("Invalid input args")
		log.Fatal(p.Desc())
	}
	probe.TCPScanExploitAPI(args[0])
	return true
}

func init() {
	exploit := serviceProbeS{}
	plugin.RegisterExploit("service-probe", exploit)
}
